﻿using System.Data;
using ET;

namespace DAL
{
    public class MCK_SchClass_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable GetData_MCK_SchClass(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_MCK_SchClass_Search");
        }
        public DataTable GetDataRow_MCK_SchClass(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SchClass_ID", id);
            return cls.GetData("sp_MCK_SchClass_SelectRow");
        }
        #endregion

        #region Insert
        public bool InsertMCK_SchClass(MCK_SchClass_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SchClass_Name", data.SchClass_Name);
            cls.AddParameter("@StartTime", data.StartTime);
            cls.AddParameter("@EndTime", data.EndTime);
            cls.AddParameter("@LateMinutes", data.LateMinutes);
            cls.AddParameter("@EarlyMinutes", data.EarlyMinutes);
            cls.AddParameter("@CheckIn", data.CheckIn);
            cls.AddParameter("@CheckOut", data.CheckOut);
            cls.AddParameter("@CheckInTime1", data.CheckInTime1);
            cls.AddParameter("@CheckInTime2", data.CheckInTime2);
            cls.AddParameter("@CheckOutTime1", data.CheckOutTime1);
            cls.AddParameter("@CheckOutTime2", data.CheckOutTime2);
            cls.AddParameter("@WorkDay", data.WorkDay);
            cls.AddParameter("@WorkMins", data.WorkMins);
            cls.AddParameter("@Weekend", data.Weekend);
            return cls.ExecuteNonQuery("sp_MCK_SchClass_Insert");
        }
        #endregion

        #region Update
        public bool UpdateMCK_SchClass(MCK_SchClass_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SchClass_ID", data.SchClass_ID);
            cls.AddParameter("@SchClass_Name", data.SchClass_Name);
            cls.AddParameter("@StartTime", data.StartTime);
            cls.AddParameter("@EndTime", data.EndTime);
            cls.AddParameter("@LateMinutes", data.LateMinutes);
            cls.AddParameter("@EarlyMinutes", data.EarlyMinutes);
            cls.AddParameter("@CheckIn", data.CheckIn);
            cls.AddParameter("@CheckOut", data.CheckOut);
            cls.AddParameter("@CheckInTime1", data.CheckInTime1);
            cls.AddParameter("@CheckInTime2", data.CheckInTime2);
            cls.AddParameter("@CheckOutTime1", data.CheckOutTime1);
            cls.AddParameter("@CheckOutTime2", data.CheckOutTime2);
            cls.AddParameter("@WorkDay", data.WorkDay);
            cls.AddParameter("@WorkMins", data.WorkMins);
            cls.AddParameter("@Weekend", data.Weekend);
            return cls.ExecuteNonQuery("sp_MCK_SchClass_Update");
        }
        #endregion

        #region Delete
        public bool DeleteMCK_SchClass(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SchClass_ID", id);
            return cls.ExecuteNonQuery("sp_MCK_SchClass_DeleteRow");
        }
        #endregion
    }
}